<?PHP

if (POST) {
    if (!ereg("^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,4}$", $_POST['email']))
        return common::result(401);
    $name = explode(' ', $_POST['name']);
    if (count($name) <= 1)
        return common::result(402);
    if (!($message = strip_tags($_POST['message'])))
        return common::result(403);
    if (strtolower($_POST['code']) != strtolower(CAPTCHA))
        return common::result(404);
    $content = '<strong>' . $_POST['name'] . '</strong>;<br />'
            . '<a href="mailto:' . $_POST['email'] . '">' . $_POST['email'] . '</a><br /><br />'
            . nl2br(htmlentities($message, ENT_COMPAT, 'UTF-8'));
    if (common::mail($_POST['name'], MAILADDR, 'iletişim::' . date('y.m.d H:i'), $content))
        common::result(200); else
        tool::result(800);
}
?>